<template>
	<uni-section title="我的全部订单" type="line">
		<uni-card v-for="order  in    tableData" :title="order.orderDate" :extra="order.totalPrice+'元'"
			:thumbnail="avatar" @click="onClick">
			<view class="uni-body">
				<uni-row v-for="item  in  order.items ">
					<uni-col :span="6">
						<image style="width: 150rpx; height: 150rpx;" :src="item.goods.imgUrl"></image>
					</uni-col>
					<uni-col :span="18"   style="display: flex; flex-wrap: wrap;">
						<view>{{item.goods.name}}</view>
						<view>{{item.count}}</view>
						<view>{{item.size}}</view>
						<view>{{item.remark}}</view>
						<view>{{item.actualPrice}}</view>
					</uni-col>

				</uni-row>
				<view>
					
					<view v-if="order.isPay =='0'" style="color: red">未支付</view>
					<view v-if="order.isPay =='1'">已支付</view>
					
				</view>

			</view>
		</uni-card>
	</uni-section>
</template>

<script setup>
	import {
		onMounted,
		ref
	} from 'vue';


	onMounted(() => {
		query()
	})

	//订单信息
	const tableData = ref([])

	const query = () => {

		const info = uni.getStorageSync("loginUser");
		const curUser = JSON.parse(info)

		uni.request({
			url: `http://localhost:3000/orders?memberId=${curUser.id}`,
			success: (res) => {
				tableData.value = res.data;
			}
		})


	}
</script>

<style>

</style>